#ifndef SPACE_OBJECT_HH
#define SPACE_OBJECT_HH

#include "atlas.hh"

class SpaceObject {
public:
	struct SO_Data {
		float x, y, z;
		unsigned int id;
		unsigned int atlas_id;
		bool collide;
		unsigned int collide_id;
		float sqrRad;
	};
private:
	SpaceObjectAtlas *m_atlas;
	unsigned int m_count;
	unsigned int m_allocated;
	SO_Data *m_host;
	SO_Data *m_device;
	bool m_device_actual;

	unsigned int m_capacity_grower;

	void EnsureCapacity(unsigned int new_capacity);
	void MakeDeviceActual();

public:
	SpaceObject(SpaceObjectAtlas *atlas);
	void AddObject(float x, float y, float z, unsigned int id, unsigned int atlas_id);

	void Collide();
	void Prepare();

	SO_Data *getObjects();
};

#endif // SPACE_OBJECT_HH
